//
//  HZMallSqlDataManager.h
//  app
//
//  Created by 刘华舟 on 15/5/13.
//  Copyright (c) 2015年 hdaren. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "SNFmdbManager.h"

/** 
 
 商城数据库管理工具类
 包含数据库事务性操作
 
 -write by khzliu */

@class HZOrderByerAddressModel, HZGoodsDetailVCData, HZCartCellModel;



@interface HZMallSqlDataManager : NSObject

+ (instancetype)defaultManager;

//--------------------------------------------------------------------------------------------
//用户地址缓存方法
//--------------------------------------------------------------------------------------------

//更新某用户地址列表缓存
- (void)updateUserDefaultAddressWithModel:(HZOrderByerAddressModel *)model temptime:(NSString *)time;
//更新某用户全部地址列表缓存
- (void)updateUserAllAddressWithModel:(NSArray *)addressList temptime:(NSString *)time;
//删除所有地址的缓存
- (BOOL)deleteAllAddressCacheData;
//删除某个地址缓存
- (BOOL)deleteUserAddressWithModel:(HZOrderByerAddressModel *)model;
//添加一个默认地址
- (BOOL)addNewUserDefaultAddressWithModel:(HZOrderByerAddressModel *)model temptime:(NSString *)time;
//查询地址时间搓
- (NSString *)queryForAddressCacheDataTemptime;
//查询用户所有地址
- (NSArray *)queryForAllUserAddress;


//--------------------------------------------------------------------------------------------
//热搜词汇缓存方法
//--------------------------------------------------------------------------------------------

//更新热搜词汇缓存
- (void)updateHotKeyWordsCacheWithData:(NSDictionary *)dict;
//插入某标签帖子列表新数据
- (BOOL)insertHotKeywordsWithhData:(NSData *)data;
//删除热搜词汇的缓存
- (BOOL)deleteHotKeywordsData;
//查询热搜词汇时间戳
- (NSString *)queryHotKeywordsTimeStamp;
//查询热搜词汇缓存
- (NSDictionary *)loadHotKeywordsData;

//--------------------------------------------------------------------------------------------
//商品分类缓存方法
//--------------------------------------------------------------------------------------------

//商品分类缓存
- (void)updateFindCategoriesWithData:(NSDictionary *)dict;
//插入商品分类新数据
- (BOOL)insertFindCategoriesWithhData:(NSData *)data;
//删除商品分类的缓存
- (BOOL)deleteFindCategoriesData;
//查询商品分类时间戳
- (NSString *)queryFindCategoriesTimeStamp;
//查询商品分类URL
- (NSString *)queryFindCategoriesURL;
//查询商品分类缓存
- (NSDictionary *)loadFindCategoriesData;

//--------------------------------------------------------------------------------------------
//记录购物车商品的选择态缓存方法
//--------------------------------------------------------------------------------------------

//更新某个商品的选择态缓存 
- (void)updateProductChoseStatuWithProductID:(NSString *)productID selected:(BOOL) isSelected;
//删除所有商品选择态的缓存
- (BOOL)deleteAllProductChoseStatus;
//查询某个商品的选择态
- (BOOL)queryProductChoseStatuWithProductID:(NSString *)prductID;


//--------------------------------------------------------------------------------------------
//搜索记录缓存方法
//--------------------------------------------------------------------------------------------

//更新历史搜索缓存
- (void)updateMallSearchHistoryCacheWithData:(NSString *)keyword;
//查询所有历史搜索
- (NSArray *)queryAllMallSearchHistory;
//删除所有历史搜索的缓存
- (BOOL)deleteAllSearchHistoryCacheData;



//--------------------------------------------------------------------------------------------
//购物车离线数据
//--------------------------------------------------------------------------------------------
//查询所有的购物车离线数据
- (NSArray *)queryAllOfflineMallCartsCacheData;
//更新某个商品的购买数量 (购物车)
- (BOOL)updateOfflineCartsCacheDataWithModel:(HZCartCellModel *)model;
//插入一个新的购物车的离线数据
- (BOOL)insertOfflineCartsCacheDataWithModel:(HZGoodsDetailVCData *)data;
//删除所有购物车的离线数据
- (BOOL)deleteOfflineCartsCacheDataWithProductID:(NSString *)productID;
//删除所有购物车的离线数据
- (BOOL)deleteAllOfflineCartsCacheData;


@end
